package group.raber.saber.kit;

//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.alibaba.fastjson.serializer.SerializeConfig;
//import com.alibaba.fastjson.serializer.SerializerFeature;
//import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
//import org.teamsir.basic.holders.ContextHolder;

/**
 * Created by tisir<yangsong158@qq.com> on 2017-02-18
 */
public class JSONKit {
    private static String dateTimeFormat = null;

//    public static String toJsonString(Object object){
//        if(object == null) return null;
//        if(dateTimeFormat == null){
//            dateTimeFormat = ContextHolder.getContextProperty("org.teamsir.basic.dateTimeSecondFormat");
//        }
//        //日期的格式化处理
//        SerializeConfig serializeConfig = new SerializeConfig();
//        serializeConfig.put(Date.class, new SimpleDateFormatSerializer(dateTimeFormat));
//
//        String str = JSON.toJSONString(object,
//                serializeConfig,
//                SerializerFeature.WriteMapNullValue,
//                SerializerFeature.PrettyFormat,
//                SerializerFeature.WriteNonStringKeyAsString,
//                SerializerFeature.SortField);
//
//        return str;
//    }
//
//    public static <T>T jsonToBean(String text,Class<T> classType){
//        return JSONObject.parseObject(text, classType);
//    }
//
//    public static <T> List<T> jsonToBeans(String text, Class<T> classType){
//        return JSONArray.parseArray(text,classType);
//    }
}
